<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.infomanage.po.*" %>
<%@page import="com.infomanage.vo.*" %>
<%@page import="com.infomanage.service.study.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    
    StudyRescueItem item = StudyRescueService.loadStudyRescue(request, response, out);
    int commanderId = -1;
    String commanderName = "";
    int deptId = -1;
    String deptName = "";
    String content = "";
    String description = "";
    String detail = "";
    String participants = "";
    String place = "";
    String timestamp = "";
    String subjects = "";
    String executeTimestamp = "";
    String problem = "";
    if(item != null) {
    	StudyRescue bean = item.getBean();
    	Person person = item.getCommander();
    	commanderId = person.getPersonId();
    	commanderName = person.getName();
    	Department dept = item.getDept();
    	deptId = dept.getDeptId();
    	deptName = dept.getPath();
    	executeTimestamp = bean.getExcuteTimestamp();
    	problem = bean.getProblem();
    	subjects = bean.getSubjects();
    	detail = bean.getDetail();
    	participants = bean.getParticipants();
    	place = bean.getPlace();
    	timestamp = bean.getTimestamp();
    	description = bean.getDescription();
    }
%>
<html>
<head>
	<title>急救训练</title>
	<link href="../../css/table.css" rel="stylesheet" type="text/css">
	<link href="../../css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/calendar.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript">
	 function init() {
	   }
	   // 提交
	   function doSubmit(){
	   		if(validate()){
	   			return;
	   		}
		 	if("" == "<%=itemId%>") {
		 		form1.actionType.value = "add";
			}else {
		 		form1.actionType.value = "modify";
			}
		 	form1.submit();
	   }

	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	   
	   function validate(){
	   		if(form1.deptId.value == -1){
	   			alert("小队不能为空！");
	   			return true;
	   		}
	   		if(form1.commanderId.value == -1){
	   			alert("指挥员不能为空！");
	   			return true;
	   		}
	   		return false;
	   }
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="rescueTrain_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="actionType">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>急救训练</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td>
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="15%">
					<col width="35%">
					<col width="12%">
					<col width="38%">
					<tr>
						<td class="field">
							小队
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/deptTree.jsp');" treeSelect="true">
								<input value="<%=deptName %>" style="width: 187px" readonly="readonly" treeSelect="true"><input name="deptId" value="<%=deptId %>" type="hidden">
							</span>
						</td>
						<td class="field">
							日期
						</td>
						<td>
							<input value="<%=timestamp %>" type="text" name="timestamp" style="width: 200px;cursor: hand;" id="time" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
									src="../../img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('time', 'y-mm-dd');">
						</td>
					</tr>
					<tr>
						<td class="field">
							训练时间
						</td>
						<td>
							<input value="<%=executeTimestamp %>" type="text" name="excuteTimestamp" style="width: 200px;">
						</td>
						<td class="field">
							训练地点
						</td>
						<td>
							<input value="<%=place %>" name="place" type="text" style="width:100%;">
						</td>
					</tr>
					<tr>
						<td class="field">
							训练项目
						</td>
						<td>
							<input value="<%=subjects%>" name="subjects" style="width: 100%" type="text">
						</td>
						<td class="field">
							指挥员
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true">
								<input value="<%=commanderName %>" style="width: 206px" readonly="readonly" treeSelect="true"><input name="commanderId" value="<%=commanderId %>" type="hidden">
							</span>
						</td>
					</tr>
				</table>
				<table class="dataTable2">
					<col width="15%">
					<col width="85%">
					<tr style="height: 100px">
						<td class="field">
							参加训练人员
						</td>
						<td>
							<textarea style="height: 100%;width: 100%" name="participants"><%=participants %></textarea>
						</td>
					</tr>
					<tr style="height: 100px">
						<td  class="field">
							训练情况
						</td>
						<td>
							<textarea style="height: 100%;width: 100%" name="detail"><%=detail %></textarea>
						</td>
					</tr>
					<tr style="height: 80px">
						<td class="field">
							存在的问题及整改措施
						</td>
						<td valign="top">
							<textarea style="width: 100%;height: 100%" name="problem"><%=problem%></textarea>
						</td>
					</tr>
					<tr style="height: 80px">
						<td class="field">
							备注
						</td>
						<td valign="top">
							<textarea style="width: 100%;height: 100%" name="description"><%=description%></textarea>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td>
				&nbsp;
			</td>
		</tr>
	</table>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>